#!/bin/bash

# 同步监听ftp文件到minio
start_mirror () {
    mc mirror --remove --force --watch /data/ftp/gtc-comm/ogcode/OGCODEFILE/ minio_pre_test/suyuan/fs/OGCODEFILE &
    mc mirror --remove --force --watch /data/ftp/gtc-comm/STADOCROOT/ minio_pre_test/suyuan/fs/STADOCROOT &
    mc mirror --remove --force --watch /data/ftp/scp/qrcode/ minio_pre_test/suyuan/fs/QROGCODEATTACH &
    mc mirror --remove --force --watch /data/ftp/scp/ogcode/ minio_pre_test/suyuan/fs/OGCODEATTACH &
    mc mirror --remove --force --watch /data/ftp/gtc-comm/DYNDOCROOT/ minio_pre_test/suyuan/fs/DYNDOCROOT &
    mc mirror --remove --force --watch /data/ftp/gtc-comm/FRAGDOCROOT/ minio_pre_test/suyuan/fs/FRAGDOCROOT &
    mc mirror --remove --force --watch /data/ftp/snsoft_gtc/video/ minio_pre_test/suyuan/fs/FTPVIDEO/video &
    mc mirror --remove --force --watch /data/ftp/scp/third/ minio_pre_test/suyuan/fs/ATTACHROOT &
}
# 停止同步监听ftp文件到minio
stop_mirror () {
    ps -ef | grep "mc mirror" | grep -v "grep" | awk '{print $2}' | xargs kill
}
case $1 in
    start) start_mirror
    ;;
    stop) stop_mirror
    ;;
    *) echo 'please use mc_mirror.sh start|stop'
    ;;
esac